package com.m2bshop.shop.dao;

import com.m2bshop.shop.pojo.data_dictionary;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface dataDictionary {

    @Select("select count(*) from data_dictionary")
    public int count();

    @Select("select * from data_dictionary")        //查询数据字典
    public List<data_dictionary> findall();

    @Select("select * from data_dictionary where id = #{id}")   //根据id查询数据字典
    public data_dictionary findbyid(int id);

    @Insert("insert into data_dictionary(dictionaryType, descrioptionOfUse, code, codeValue) values(#{dictionaryType}, #{descrioptionOfUse}, #{code}, #{codeValue})")   //新增数据字典
    public int insertone(data_dictionary data_dictionary);

    @Update("update data_dictionary set dictionaryType=#{dictionaryType}, descrioptionOfUse=#{descrioptionOfUse}, code=#{code}, codeValue=#{codeValue} where id=#{id}") //根据ID修改数据字典
    public int updateone(data_dictionary data_dictionary);

    @Delete("delete from data_dictionary where id=#{id}")   //根据ID删除数据字典
    public int deleteone(int id);
}
